<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>面向对象01</title>
    <style>
        .myDiv1{
width: 100px;
height: 100px;
background-color:red;
        }
    </style>
</head>
<body>
    <div class="myDiv1"></div>
    <script>
        let myDiv1 = document.querySelector(".myDiv1");
        myDiv1.onmousedown = e=>{
            let ev =e|| window.event;
            let x= ev.clentX-myDiv1.offsetLeft;
            let y=ev.clentY-myDiv1.offsetTop
        }
    </script>
</body>
</html>